<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height:2000px;
        }
        p {
            margin-top: 20px;
        }
        div{
            position: sticky;
            top : 0px;
        }
    </style>
</head>

<body>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<div>这是一个粘性盒子</div>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
<p>pppppppppppppppppp</p>
</body>

</html>
